$(document).ready(function(){$("input#showform").click(function(){$("#installer_form").slideToggle("slow")})});var i=0;var map;var gmarkers=[];var htmls=[];var icon=[1,2];var installers=[];var nations={};var provinces={};var installer_full={};var installer_part={};var installers={};var office="";var icon=[1,2];var InitialLatitude=46;var InitialLongitude=-97;var InitialZoom=4;var sidebar="";var bounds={};icon[1]=new GIcon();icon[1].image="/res/markers/little_green.png";icon[1].shadow="/res/markers/little_shadow.png";icon[1].iconSize=new GSize(12,20);icon[1].shadowSize=new GSize(22,20);icon[1].iconAnchor=new GPoint(6,20);icon[1].infoWindowAnchor=new GPoint(5,1);icon[1].on="/res/markers/little_greenb.png";icon[1].off=icon[1].image;icon[2]=new GIcon();icon[2].image="/res/markers/little_gray.png";icon[2].shadow="/res/markers/little_shadow.png";icon[2].iconSize=new GSize(12,20);icon[2].shadowSize=new GSize(22,20);icon[2].iconAnchor=new GPoint(6,20);icon[2].infoWindowAnchor=new GPoint(5,1);icon[2].on="/res/markers/little_grayb.png";icon[2].off=icon[2].image;office=new GIcon();office.image="/res/markers/little_red.png";office.shadow="/res/markers/little_shadow.png";office.iconSize=new GSize(12,20);office.shadowSize=new GSize(22,20);office.iconAnchor=new GPoint(6,20);office.infoWindowAnchor=new GPoint(5,1);office.on="/res/markers/little_red.png";office.off=office.image;var param_wsId="od6";var param_ssKey="pEoF0gSoCavClku9_4jgqew";function show_installers(a){$("#installers").html("");if(installer_full[a]!=null||installer_part[a]!=null){$("#installers").append(installer_full[a]).append(installer_part[a]);$("#installers tr").hover(function(){var b=$(this).attr("class").substr(1);gmarkers[b].setImage(installer_full.on)},function(){var b=$(this).attr("class").substr(1);gmarkers[b].setImage(installer_full.off)});$("#installers tr").click(function(){var b=$(this).attr("class").substr(1);myclick(b)})}}function myclick(a){gmarkers[a].openInfoWindowHtml(htmls[a])}function cm_load(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.addMapType(G_PHYSICAL_MAP);map.setCenter(new GLatLng(InitialLatitude,InitialLongitude),InitialZoom);cm_getJSON()}else{alert("Sorry, the Google Maps API is not compatible with this browser")}}function cm_loadMapJSON(m){bounds.World=new GLatLngBounds();for(var c in m.feed.entry){var h=m.feed.entry[c];if(h["gsx$lat"]&&h["gsx$lat"].$t.length>1){var d={};d.re=h["gsx$recommended"].$t;d.ins=h["gsx$installed"].$t;d.cn=h["gsx$company"].$t;d.con=h["gsx$contact"].$t;d.ad=h["gsx$address"].$t;d.ci=h["gsx$city"].$t;d.st=h["gsx$state"].$t;d.zi=h["gsx$zip"].$t;d.co=h["gsx$country"].$t;d.lat=parseFloat(h["gsx$lat"].$t);d.lng=parseFloat(h["gsx$lng"].$t);d.tf=h["gsx$toll-free"].$t;d.te=h["gsx$tel"].$t;d.fa=h["gsx$fax"].$t;d.web=h["gsx$website"].$t;d.email=h["gsx$email"].$t;var k=new GLatLng(d.lat,d.lng);bounds.World.extend(k);if(!bounds[d.co]){bounds[d.co]=new GLatLngBounds()}bounds[d.co].extend(k);if(d.st.length>0){if(!provinces[d.co]){provinces[d.co]={}}}if(d.re==1){var l='<h4 class="recommended">Recommended</h4>'}else{var l="";d.re=2}l+="<h4>"+d.cn+"</h4>";if(d.con.length>0){l+="<p>Contact: <b>"+d.con+"</b></p>"}l+="<p>"+d.ad+"<br />"+d.ci;if(d.st.length>0){l+=", "+d.st}if(d.zi.length>0){l+="&nbsp;&nbsp;"+d.zi}l+="<br />";if(d.co.length>0){l+=d.co}if(d.tf.length>0){l+="<br />Toll-free <b>"+d.tf+"</b>"}if(d.te.length>0){l+="<br />Tel <b>"+d.te+"</b>"}if(d.fa.length>0){l+="<br />Fax "+d.fa}l+="</p><p>";if(d.web.length>0){l+='<a class="url" href="http://'+d.web+'">'+d.web+"</a>"}if(d.email.length>0){l+='<a class="url" href="mailto:'+d.email+'">'+d.email+"</a>"}l+="</p>";if(d.ins.length>0){l+='<p class="installed">Over <b>'+d.ins+"</b> GPS tracking devices installed</p>"}if(!installers[d.co]){installers[d.co]=""}if(d.re==1){var g="little_green.gif"}else{var g="little_gray.gif";d.re=2}if(d.re==1){var a=" recommended"}else{var a=""}var e='<tr class="d'+i+" installer"+a+'"><td><img src="/res/markers/'+g+'" alt="installer" /></td><td><b>'+d.cn+"</b><br />"+d.ci;if(d.st.length>0){e+=", "+d.st}e+=", "+d.co;e+="</td>";e+="</tr>";installers[d.co]+=e;var b=createMarker(k,icon[d.re],icon[d.re].on,icon[d.re].off,l);map.addOverlay(b);bounds.World.extend(k)}}for(j in installers){sidebar+='<table><thead><tr class="'+j+' country"><td colspan="3"><i>Show&nbsp;/&nbsp;Hide</i>'+j+"</td></tr></thead>";sidebar+='<tbody class="list">';sidebar+=installers[j];sidebar+="</tbody></table>"}$("#installers").html(sidebar);$("#installers tr.country").parent().next("tbody.list").fadeOut("slow");$("#installers tr.country").toggle(function(){$(this).parent().next("tbody.list").show()},function(){$(this).parent().next("tbody.list").hide()});$("#installers tr.installer").hover(function(){var n=$(this).attr("class").split(" ");var f=n[0].substr(1)},function(){});$("#installers tr.installer").click(function(){var n=$(this).attr("class").split(" ");var f=n[0].substr(1);myclick(f)});$("#installers tr.country").click(function(){var f=$(this).attr("class").split(" ");var n=f[0];map.setZoom(map.getBoundsZoomLevel(bounds[n]));map.setCenter(bounds[n].getCenter())});map.setZoom(map.getBoundsZoomLevel(bounds.World));map.setCenter(bounds.World.getCenter())}function createMarker(a,e,c,g,f){var b=new GMarker(a,e);var d='<div class="installer">'+f+"</div>";GEvent.addListener(b,"click",function(){b.openInfoWindowHtml(d)});GEvent.addListener(b,"mouseover",function(){b.setImage(c)});GEvent.addListener(b,"mouseout",function(){b.setImage(g)});htmls[i]=d;gmarkers[i]=b;i++;return b}function cm_getJSON(){var a=document.createElement("script");a.setAttribute("src","http://spreadsheets.google.com/feeds/list/"+param_ssKey+"/"+param_wsId+"/public/values?alt=json-in-script&callback=cm_loadMapJSON");a.setAttribute("id","jsonScript");a.setAttribute("type","text/javascript");document.documentElement.firstChild.appendChild(a)}setTimeout("cm_load()",500);